package com.unicom.zh.controller;

import com.unicom.zh.annotation.MyAnno;
import com.unicom.zh.pojo.User;
import com.unicom.zh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.websocket.server.PathParam;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/toLogin")
    public String toLogin(){
        System.out.println("进入Controller");
        return "login"; //login.html
    }

    @RequestMapping("/doLogin")
    @ResponseBody
    public User doLogin(String userId){
        return userService.findUserById(userId);
    }
}
